<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_weblinks
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<div class="container ultimos-eventos">
<h3>Eventos</h3>
<ul class="events<?php echo $moduleclass_sfx; ?>">
	<?php 
		$i = 0;
		$tot = count($list);
		
		foreach ($list as $item) :
			$datestart = explode("-", $item->datestart) ;
			$hourstart = substr($item->hourstart, 0, 5) ;
							
		?>
		
		
		<li 
			<?php echo $i . ' class="semfoto ';
			if($i % 2==0) echo ' par ';
			if ($tot % 2 ==0 && $i>=$tot-2) 
				echo 'ultimo';
			elseif($i==($tot-1))
				echo 'ultimo'; 
			 
			echo '"';?>>	
		<div>
			<h4><?php echo $datestart[2].'/'.$datestart[1] . '/' .$datestart[0] .' - ' . $hourstart  ?></h4>					
			<a href="<?php echo JRoute::_('index.php?option=com_events&view=evento&id=' . (int)$item->id); ?>" title="<?php echo $item->title; ?>"><?php echo $item->title; ?></a>
			<p><?php echo $item->intro; ?> </p>
		</div>				
		</li>
	<?php
	
	$i++;
	endforeach;
	?>
</ul>
</div>
